
<html>
<body>
<head>
    <title>	My Calendar </title>
    
    <meta http-equiv="Content-Type" content="text/html;charset=UTF-8"/>
</head>    
<?php
include_once("php/dbconfig.php");
//header("Content-Type: text/html;charset=uft-8");
//$con = mysql_connect("localhost","amcnnc5","3prismcreation");
////$con = mysql_connect("localhost","root","00000000");
//if (!$con)
//{
//  die('Could not connect: ' . mysql_error());
//}
//
//
//mysql_query("set character set 'utf8'");//读库
//          mysql_query("set names 'utf8'");//写库
//            //change to your database name
//		mysql_select_db("amcnnc5_dev_amcnn") or 
//		     die("Could not select database: " . mysql_error());
$sqlInsert ="insert  into `cs_parameter`(`parameter_code`,`parameter_value`,`description`) values 
    ('dbTablePrefix','amcnn_','數據表的前綴'),
    ('defaultTime','23:59:59','默認的Event結束時間'),
    ('downloadPath','/download/','導出文件的臨時存放位置'),
    ('homePage','/amcnn/?q=admin','無權限登錄返回的頁面'),
    ('pageSize','10','分頁顯示時每頁顯示多少行'),
    ('uploadFileSize','300','可上傳的文件大小(KB)'),
    ('uploadPath','/upload','導入文件的臨時存放位置'),
    ('xNumberDays','60','前後多少天');";

//$sqlUpdate = "UPDATE `cs_parameter` SET `parameter_value` = '/calendarservice/download/excel/' WHERE parameter_code = 'downloadPath';";
//$sqlUpdate2 = "UPDATE `cs_parameter` SET `parameter_value` = '/calendarservice/upload/excel' WHERE parameter_code = 'uploadPath';";
//$sqlUpdate = "UPDATE `cs_parameter` SET `parameter_value` = '/user' WHERE parameter_code = 'homePage';";

$sqlInsertImag = $sqlInsert ="insert  into `cs_parameter`(`parameter_code`,`parameter_value`,`description`) values 
    ('imgUploadPath','/calendarservice/upload','圖片上傳路徑')";

$sqlUpdateEvent = //"ALTER TABLE `event` CHANGE COLUMN `detail_url` `detail_url` VARCHAR(150) NULL DEFAULT NULL  ;";

"ALTER TABLE `event` CHANGE COLUMN `picture_paths` `picture_paths` VARCHAR(150) NULL DEFAULT NULL  ;";

//$sqlAlterEventType = "ALTER TABLE `event_type` ADD COLUMN `color_mark` VARCHAR(25) NULL  AFTER `delete_flag` ;";
$sqoUpdateEventType = "UPDATE `event_type` SET `color_mark`='#E1F7EE' WHERE `name_zh_hk`='展覽'";

$sqlUpdateEvent = "ALTER TABLE `event` ADD COLUMN `commercial_control` INT(10) NULL DEFAULT 0  AFTER `flash_paths` ;";

$sqlUpdateRevisions = "UPDATE `amcnn_node_revisions` SET `body`='<script type=\"text/javascript\">$(\"#columns\").hide();$(\"#header-region\").hide();$(\"#slider_menu_container\").after(\"<div id=\'wdCalendar\' height=\'800px\'><iframe src=\'/calendarservice/index.php\' width=\'100%\' height=\'820px\' scrolling=\'no\'></iframe></div>\");</script>' WHERE `vid`='66';";

$sqlShowTable = 'show tables';

//$sqlRead = "select * from `event_type`";

$sqlRead = "select `commercial_control` from `event`";

try {
    
     $db = new DBConnection();
     $db->getConnection();
    
    if (mysql_query($sqlUpdateRevisions) == false)
    {
        echo '<br>update event fail</br>';
        echo mysql_error();
    }
 else {
     echo '<br>update event sucessfully</br>'; 
}


//      if (mysql_query($sqlUpdate2) == false)
//    {
//        echo '<br>update cs_parameter fail</br>';
//        echo mysql_error();
//    }
// else {
//     echo '<br>update cs_parameter sucessfully</br>'; 
//}
  
    //if(mysql_query($sqlShowTable,$con) == false)
//      if(mysql_query($sqlShowTable) == false)
//     {
//         echo '<br>Read table fail</br>';
//         echo mysql_error();
//     }
// else {
//         echo '<br>Read table sucessfully</br>';
//         $result = mysql_query($sqlShowTable);
//         while($row = mysql_fetch_array($result)) 
//         {
//             echo '<br>'.$row[0].'</br>';
//         }
//     } 
    
    

 //if(mysql_query($sqlRead,$con) == false)
   if(mysql_query($sqlRead) == false)
     {
         echo '<br>Read venue table fail</br>';
         echo mysql_error();
     }
 else {
         echo '<br>Read venue table sucessfully</br>';
         $result = mysql_query($sqlRead);
         while($row = mysql_fetch_array($result)) 
         {
             echo 'field count: '.count($row);
             echo '<br>'.$row[0].'#'.$row[1].'#'.$row[2].$row[5].'</br>';
         }
     }
}catch(Exception $e)
{
    echo $e->getMessage(); 
};

//mysql_close($con);
/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
?>

</body>
</html>
